package api

import (
	"github.com/gin-gonic/gin"
	"golang-websocket-chatroom/api/handler"
	"golang-websocket-chatroom/pkg"
)

func Loadrouter(router *gin.Engine) {
	router = gin.Default()

	// 简单的路由组: v1
	v1 := router.Group("/v1")
	{

		v1.POST("/login", handler.Login)
		v1.POST("/show", handler.Show)
	}
	Ws := router.Group("/ws")
	{
		Ws.Use(pkg.JWTAuth("zk2"))
		Ws.GET("/ws", handler.Ws)
	}
	Group := router.Group("/group")
	{
		Ws.Use(pkg.JWTAuth("zk2"))
		Group.POST("/groupcreate", handler.GroupCreate)

	}
	Chat := router.Group("/chat")
	{
		Ws.Use(pkg.JWTAuth("zk2"))
		Chat.POST("/chatcreate", handler.ChatCreate)

	}
	router.Run(":8080")
}
